package cn.mysdp.biz.controller;


import cn.mysdp.biz.controller.*;
import cn.mysdp.biz.dto.request.*;
import cn.mysdp.biz.dto.response.*;

import java.util.List;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: SdpHistoryWebController
 * @Description:
 * @Author: SDP
 * @Date: 2021-10-30
 * @Version: 1.0
 * Table: sdp_history
 * Comment:
 * 
 */
@RestController
@RequestMapping(value = "/sdp_history")
public class SdpHistoryWebController extends SdpHistoryWebCustomController {
    static {
        addRequestClass("sdp_history", "add", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryAddRequest.class);
        addRequestClass("sdp_history", "add_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryAddRequest.class);

        addRequestClass("sdp_history", "update", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryUpdateRequest.class);
        addRequestClass("sdp_history", "update_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryUpdateRequest.class);

        addRequestClass("sdp_history", "delete", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryDeleteRequest.class);
        addRequestClass("sdp_history", "delete_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryDeleteRequest.class);

        addRequestClass("sdp_history", "query", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);
        addRequestClass("sdp_history", "query_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);

        addRequestClass("sdp_history", "list", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);
        addRequestClass("sdp_history", "list_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);

        addRequestClass("sdp_history", "count", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);
        addRequestClass("sdp_history", "count_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);

        addRequestClass("sdp_history", "stat", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);
        addRequestClass("sdp_history", "stat_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryQueryRequest.class);

    }

    @PostMapping("/add")
    public Integer addSdpHistory(@RequestBody SdpHistoryAddRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_history", "add", request, callFromEncrypt);
        return super.addSdpHistory(request);
    }

    @PostMapping("/add_encrypt")
    public String addSdpHistoryEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryAddRequest request = (SdpHistoryAddRequest) super.decrypt("sdp_history", "add_encrypt", strRequest, SdpHistoryAddRequest.class);
        Integer result = addSdpHistory(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/update")
    public Integer updateSdpHistory(@RequestBody SdpHistoryUpdateRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_history", "update", request, callFromEncrypt);
        return super.updateSdpHistory(request);
    }

    @PostMapping("/update_encrypt")
    public String updateSdpHistoryEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryUpdateRequest request = (SdpHistoryUpdateRequest) super.decrypt("sdp_history", "update_encrypt", strRequest, SdpHistoryUpdateRequest.class);
        Integer result = updateSdpHistory(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/delete")
    public Integer deleteSdpHistory(@RequestBody SdpHistoryDeleteRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_history", "delete", request, callFromEncrypt);
        return super.deleteSdpHistory(request);
    }

    @PostMapping("/delete_encrypt")
    public String deleteSdpHistoryEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryDeleteRequest request = (SdpHistoryDeleteRequest) super.decrypt("sdp_history", "delete_encrypt", strRequest, SdpHistoryDeleteRequest.class);
        Integer result = deleteSdpHistory(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/query")
    public SdpHistoryQueryResponse querySdpHistory(@RequestBody SdpHistoryQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("sdp_history", "query", request, callFromEncrypt);
      SdpHistoryQueryResponse result = super.querySdpHistory(request);
      super.fixResult("sdp_history", "query", request);
      return result;
    }

    @PostMapping("/query_encrypt")
    public String querySdpHistoryEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryQueryRequest request = (SdpHistoryQueryRequest) super.decrypt("sdp_history", "query_encrypt", strRequest, SdpHistoryQueryRequest.class);
        SdpHistoryQueryResponse result = querySdpHistory(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/list")
    public List<SdpHistoryQueryResponse> listSdpHistory(@RequestBody SdpHistoryQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_history", "list", request, callFromEncrypt);
        List<SdpHistoryQueryResponse> list = super.listSdpHistory(request);
        super.fixResult("sdp_history", "list", list);
        return list;
    }

    @PostMapping("/list_encrypt")
    public String listSdpHistoryEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryQueryRequest request = (SdpHistoryQueryRequest) super.decrypt("sdp_history", "list_encrypt", strRequest, SdpHistoryQueryRequest.class);
        List<SdpHistoryQueryResponse> result = listSdpHistory(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/count")
    public Integer countSdpHistory(@RequestBody SdpHistoryQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("sdp_history", "count", request, callFromEncrypt);
      return super.countSdpHistory(request);
    }


    @PostMapping("/count_encrypt")
    public String countSdpHistoryEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryQueryRequest request = (SdpHistoryQueryRequest) super.decrypt("sdp_history", "count_encrypt", strRequest, SdpHistoryQueryRequest.class);
        Integer result = countSdpHistory(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/stat")
    public BaseStatResponse statSdpHistory(@RequestBody SdpHistoryQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_history", "stat", request, callFromEncrypt);
        return super.statSdpHistory(request);
    }

    @PostMapping("/stat_encrypt")
    public String statSdpHistoryEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryQueryRequest request = (SdpHistoryQueryRequest) super.decrypt("sdp_history", "stat_encrypt", strRequest, SdpHistoryQueryRequest.class);
        BaseStatResponse result = statSdpHistory(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    static {
        addRequestClass("sdp_history", "clear", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryForClearRequest.class);
        addRequestClass("sdp_history", "clear_encrypt", "sdpHistoryController", SdpHistoryWebController.class, SdpHistoryForClearRequest.class);
    }
    
    @PostMapping("/clear")
    public Integer clear(@RequestBody SdpHistoryForClearRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_history", "clear", request, callFromEncrypt);
        return super.clear(request);
    }

    @PostMapping("/clear_encrypt")
    public String clearEncrypt(@RequestBody String strRequest) throws Exception {
        SdpHistoryForClearRequest request = (SdpHistoryForClearRequest)decrypt("sdp_history", "clear_encrypt", strRequest, SdpHistoryForClearRequest.class);
        Integer result = clear(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);
        
        return super.encrypt(request, response);
    }


}
